Cover TOC Chap Prev Chap Prev Fig Next Fig Next Chap

Chapter 18: Controlling Texture Mapping

../ch18/18fig21.gif
Figure 18.21

A pizza and slice.

18fig21.wrl
Click on the image to view the VRML scene.

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Shape {
    appearance Appearance {
        material Material { }
        texture ImageTexture {
            url "pizza.jpg"
        }
    }
    geometry IndexedFaceSet {
        coord Coordinate {
            point [
            # Slice, pulled out of pizza
                 0.50 0.0  0.50,   0.88 0.0  1.42,
                 1.06 0.0  1.33,   1.21 0.0  1.21,
                 1.33 0.0  1.06,   1.42 0.0  0.88,
            # Rest of pizza
                 0.00 0.0  0.00,   0.92 0.0  0.38,
                 0.98 0.0  0.20,   1.00 0.0  0.00,
                 0.98 0.0 -0.20,   0.92 0.0 -0.38,
                 0.83 0.0 -0.56,   0.71 0.0 -0.71,
                 0.56 0.0 -0.83,   0.38 0.0 -0.92,
                 0.20 0.0 -0.98,   0.00 0.0 -1.00,
                -0.20 0.0 -0.98,  -0.38 0.0 -0.92,
                -0.56 0.0 -0.83,  -0.71 0.0 -0.71,
                -0.83 0.0 -0.56,  -0.92 0.0 -0.38,
                -0.98 0.0 -0.20,  -1.00 0.0  0.00,
                -0.98 0.0  0.20,  -0.92 0.0  0.38,
                -0.83 0.0  0.56,  -0.71 0.0  0.71,
                -0.56 0.0  0.83,  -0.38 0.0  0.92,
                -0.20 0.0  0.98,   0.00 0.0  1.00,
                 0.20 0.0  0.98,   0.38 0.0  0.92
            ]
        }
        coordIndex [
        # Slice
             0,  1,  2,  3,  4,  5, -1,
        # Rest of pizza
             6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
            17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
            28, 29, 30, 31, 32, 33, 34, 35
        ]
        texCoord TextureCoordinate {
            point [
            # Center point of pizza image
                0.50 0.50,
            # Pizza perimeter
                0.96 0.41,  0.97 0.50,
                0.96 0.59,  0.93 0.68,
                0.89 0.76,  0.83 0.83,
                0.76 0.89,  0.68 0.93,
                0.59 0.96,  0.50 0.97,
                0.41 0.96,  0.32 0.93,
                0.24 0.89,  0.17 0.83,
                0.11 0.76,  0.07 0.68,
                0.04 0.59,  0.03 0.50,
                0.04 0.41,  0.07 0.32,
                0.11 0.24,  0.17 0.17,
                0.24 0.11,  0.32 0.07,
                0.41 0.04,  0.50 0.03,
                0.59 0.04,
            # Slice perimeter
                0.68 0.07,  0.76 0.11,
                0.83 0.17,  0.89 0.24,
                0.93 0.32
            ]
        }
        texCoordIndex [
        # Slice
            0, 28, 29, 30, 31, 32, -1,
        # Rest of pizza
            0,  32,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,
            11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
            23, 24, 25, 26, 27, 28
        ]
        solid FALSE
    }
}